package cn.iocoder.yudao.module.wine.controller.app.config;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.infra.api.config.InfraConfigApi;
import cn.iocoder.yudao.module.infra.api.config.dto.AppInfraConfigDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

/**
 * @author zyc
 * @createDate 2024/6/18 11:39
 */

@Tag(name = "用户 APP - 系统配置信息")
@RestController
@RequestMapping("/wine/config")
@Validated
public class AppConfigController {
    @Resource
    private InfraConfigApi infraConfigApi;

    @GetMapping("/get")
    @Operation(summary = "通过分类名称获得系统配置信息")
    @Parameter(name = "categoryName", description = "分类名称", required = true, example = "分类名称")
    public CommonResult<List<AppInfraConfigDTO>> getComplainInfo(@RequestParam("categoryName") String categoryName) {
        List<AppInfraConfigDTO> configByCategory = infraConfigApi.getConfigByCategory(categoryName);
        return success(configByCategory);
    }
}
